package dongshi.daddy.springioc.three.three_three.bean;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

/**
 * 人类实现类
 */
@Component("businessPersonWithConstructor")
public class BusinessPersonWithConstructor implements Person {
    private Animal animal = null;

    public BusinessPersonWithConstructor(@Autowired @Qualifier("dog") Animal animal) {
        this.animal = animal;
    }

    @Override
    public void service() {
        this.animal.use();
    }

    @Override
    public void setAnimal(Animal animal) {
        this.animal = animal;
    }
}
